package libScene.src.j2me.m3g;

import javax.microedition.lcdui.Graphics;
import javax.microedition.m3g.Background;
import javax.microedition.m3g.Camera;
import javax.microedition.m3g.Graphics3D;
import javax.microedition.m3g.World;


public class SceneView {
    Graphics3D graphics3d;
    World world;
    Camera camera3D;
    Background background;
    
    public SceneView(){
        graphics3d = Graphics3D.getInstance();
        graphics3d.setDepthRange(0.1f, 0.9f);
        world = new World();
        camera3D = new Camera();
        background = new Background();
        background.setColor(0xFF0000);
        world.setBackground(background);
        camera3D.setPerspective(45.0f, 1.0f, 0.5f, 255.0f);
        world.addChild(camera3D);
        camera3D.translate(1,  1, 2);
        camera3D.setOrientation(0.0f, 0.0f, 1.0f, 0.0f);
        world.setActiveCamera(camera3D);
        camera3D.setPickingEnable(false);
        world.setPickingEnable(false);
    }
    
	public void paint(Graphics g){
        graphics3d.bindTarget(g);
        graphics3d.render(world);
        graphics3d.releaseTarget();
	}
}
